package org.example;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Bean;
import org.example.bean.Product;
@Configuration

public class Appconfiging {

    //相当于原来在 beans.xml中配置的  <bean id="p1" class="xxxx" >
    @Bean
    public Product p1(){
        //硬编码...
       Product p=new Product();
        p.setId(1001);
       p.setPname("张三");
        p.setPrice(100);
       return p;
   }
}